ATMega328: Uploading Code with 9600 Baud

2020-5-6

The Optiboot Bootloader can be configured to work at 9600 Baud.
This is useful for uploading through slow elements, for example optocouplers.
It can be built for an ATMega328P running at 16 MHz using
make clean
make atmega328p AVR_FREQ=16000000 BAUD_RATE=9600
as documented here.
Now the generated optiboot_atmega328p.hex can be burned over ISP onto the µC.

If you have a switch statement reading serial bytes in your code, you can add
case 0x30:
while (Serial.available() == 0);
if (Serial.read() == 0x20)
{
goto * 0x7000;
}
break;
to automatically jump to the bootloader once AVRDUDE starts an upload.

If you are using the Arduino IDE, make a new folder in your Arduino/hardware folder and copy the contents of Arduino/hardware/arduino into it.
Then in the boards.txt delete everything besides entries starting with uno. and the menu.cpu entry.
Change
uno.upload.speed
to
9600
.
In the platform.txt change name to something else, for example
Arduino 9600 Baud
.
The Optiboot Bootloader can be configured to work at 9600 Baud.
This is useful for uploading through slow elements, for example optocouplers.
It can be built for an ATMega328P running at 16 MHz using
make clean
make atmega328p AVR_FREQ=16000000 BAUD_RATE=9600
as documented here.

Now the generated optiboot_atmega328p.hex can be burned over ISP onto the µC.

If you have a switch statement reading serial bytes in your code, you can add
case 0x30:
while (Serial.available() == 0);
if (Serial.read() == 0x20)
{
goto * 0x7000;
}
break;
to automatically jump to the bootloader once AVRDUDE starts an upload.


If you are using the Arduino IDE, make a new folder in your Arduino/hardware folder and copy the contents of Arduino/hardware/arduino into it.
Then in the boards.txt delete everything besides entries starting with uno. and the menu.cpu entry.
Change
uno.upload.speed
to
9600
.

In the platform.txt change name to something else, for example
Arduino 9600 Baud
.




Back